<style type="text/css">
    .layui-table-body{overflow-x:auto;}
    .layui-table-cell{font-size:12px;}
</style>
<table id="dataTable"></table>

<script type="text/html" id="statusTpl">
    <input type="checkbox" name="status" value="{{ d.status }}" lay-skin="switch" lay-filter="switchStatus" lay-text="正常|关闭" {{ d.status == 1 ? 'checked' : '' }} data-href="{:url('status')}?id={{ d.id }}">
</script>
<script type="text/html" title="操作按钮模板" id="buttonTpl">
    {{# if(d.status == 1){ }}
    <a href="{:url('edit')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-normal hisi-iframe-pop"  hisi-data="{width: '800px', height: '600px', title: '审核'}">审核</a>
    {{# } }}
    <a href="{:url('wei')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-normal hisi-iframe-pop"  hisi-data="{width: '1000px', height: '700px', title: '尾款'}">尾款</a>
    <a href="{:url('edit')}?id={{ d.id }}&xx=2" target="_blank" class="layui-btn layui-btn-xs layui-btn-normal" >打印</a>
    <!-- <a href="{:url('del')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-danger j-tr-del">删除</a> -->
</script>
{include file="system@block/layui" /}
<script id="toolbar" type="text/html">
    <a href="{:url('add')}" class="layui-btn layui-btn-normal layui-btn-sm hisi-iframe-pop" hisi-data="{width: '800px', height: '600px', title: '添加'}">&nbsp;充值</a>
</script>
<script type="text/javascript">
    layui.use(['table'], function() {
        var table = layui.table;
        table.render({
            elem: '#dataTable'
            ,url: '{:url()}' //数据接口
            ,page: true //开启分页
            ,skin: 'row'
            ,even: true
            ,limit: 20
            ,text: {
                none : '暂无相关数据'
            }
            ,toolbar: '#toolbar'
            ,defaultToolbar: ['filter']
            ,cols: [[ //表头
                {type:'checkbox'}
                ,{field: 'sn', title: '操作单号'}
                ,{field: 'user_id_text', title: '会员'}
                ,{field: 'shop_id_text', title: '门店'}
                ,{field: 'course_id_text', title: '会员卡'}
                ,{field: 'price1', title: '售价'}
                ,{field: 'q1', title: '实交'}
                ,{field: 'q2', title: '欠款'}
                ,{field: 'cashier_id_text', title: '收银'}
                ,{field: 'adviser_id_text', title: '顾问'}
                ,{field: 'technician_text', title: '美容师'}
                ,{field: 'finance_id_text', title: '财务'}
                ,{field: 'account_id_text', title: '账户'}
                ,{field: 'bak', title: '备注'}
                ,{field: 'createtime', title: '充值时间',sort:true}
                ,{field: 'status', title: '状态', width: 100, templet: function(d){
                    // 状态：1=开单，2=审核通过，3=审核不通过',
                    if(d.status == 1){
                        return '等待审核'
                    }
                    if(d.status == 2){
                        return '审核通过'
                    }
                    if(d.status == 3){
                        return '审核不通过'
                    }
                }}
                ,{title: '操作', width: 120, templet: '#buttonTpl'}
            ]]
            ,done: function(){
                if (typeof(layui.global.addTableTool) !== 'undefined') {
                    layui.global.addTableTool();
                }
            }
        });
    });
</script>
